//
//  PpEquipmentViewController.swift
//  Palmpilot
//
//  Created by 杨伟毅 on 2018/10/22.
//  Copyright © 2018年 杨伟毅. All rights reserved.
//

import UIKit

class PpEquipmentViewController: PpBaseViewController,UITableViewDataSource,UITableViewDelegate {
    let baseEquipmentVC = UITableView.init(frame: ZCGRECT(x: 0, y: 0, width: SCREEN_width, height: SCREEN_HEIGHT-TopHeight))
    let tiitleArr = [PpLanguageSwitchTool.getString(key: "Knapsack"),PpLanguageSwitchTool.getString(key: "Camping"),PpLanguageSwitchTool.getString(key: "Lighting"),PpLanguageSwitchTool.getString(key: "Cooking utensils"),PpLanguageSwitchTool.getString(key: "Water fittings"),PpLanguageSwitchTool.getString(key: "Newsletter"),PpLanguageSwitchTool.getString(key: "Other articles")]
    let contenArr = [PpLanguageSwitchTool.getString(key: "KnapsackTips"),PpLanguageSwitchTool.getString(key: "CampingTips"),PpLanguageSwitchTool.getString(key: "LightingTips"),PpLanguageSwitchTool.getString(key: "CookingUtensilsTips"),PpLanguageSwitchTool.getString(key: "WaterFittingsTips"),PpLanguageSwitchTool.getString(key: "NewsletterTips"),PpLanguageSwitchTool.getString(key: "OtherArticlesTips")]
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.title = PpLanguageSwitchTool.getString(key: "Equipment supplies")
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        baseEquipmentVC.delegate = self
        baseEquipmentVC.dataSource = self
        baseEquipmentVC.register(UINib.init(nibName: "PpWearFirstTableViewCell", bundle: Bundle.main), forCellReuseIdentifier: "PpWearFirstTableViewCell")
        baseEquipmentVC.estimatedRowHeight = 120
        baseEquipmentVC.tableFooterView = UIView()
        self.view.addSubview(baseEquipmentVC)
        PpBaseTool.insetTableViewAndUIViewController(baseView: baseEquipmentVC, baseVC: self)
        // Do any additional setup after loading the view.
    }
    func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return tiitleArr.count
    }
    
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return UITableViewAutomaticDimension
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let baseCell:PpWearFirstTableViewCell = tableView.dequeueReusableCell(withIdentifier: "PpWearFirstTableViewCell") as! PpWearFirstTableViewCell
        baseCell.titlelabel.text = tiitleArr[indexPath.row]
        baseCell.comtentLabel.text = contenArr[indexPath.row]
        baseCell.selectionStyle  = .none
        return baseCell
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
